home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntinc20 / xbra.h < prev   
C/C++ Source or Header  |  1992-05-15  |  1KB  |  51 lines

  1. #ifndef _XBRA_H
  2. #define _XBRA_H
  3.  
  4. #ifndef _COMPILER_H
  5. #include <compiler.h>
  6. #endif
  7.  
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11.  
  12. typedef void    (*xptr) __PROTO((void));
  13.  
  14. typedef struct __xbra
  15. {
  16.   long    xbra_magic;
  17.   long    gnuc_magic;
  18.   xptr    next;
  19.   short    jump;
  20.   void    (*this) __PROTO((void));
  21. }    xbra_struct;
  22.  
  23. #define _XBRA_MAGIC    0x58425241L /* "XBRA" */
  24. #define _GNUC_MAGIC    0x474E5543L /* "GNUC" */
  25. #define _JMP_OPCODE    0x4EF9
  26. #define _JSR_OPCODE    0x4EB9
  27.  
  28. #define _XBRA_VEC(x)    ((void (*) __PROTO((void))) &(x.jump))
  29.  
  30. #define _XBRA_INIT(fn)    {           \
  31.                _XBRA_MAGIC,    \
  32.                _GNUC_MAGIC,    \
  33.                (xptr) 0,       \
  34.                _JMP_OPCODE,    \
  35.                (void (*) __PROTO((void))) fn \
  36.             }
  37.  
  38. #define _TRAP_VEC(n,x)    ((void (*) __PROTO((void))) (((long) n << 24) | (long) &(x.jump)))
  39.  
  40. #define _TRAP_INIT(fn)    {           \
  41.                _XBRA_MAGIC,    \
  42.                _GNUC_MAGIC,    \
  43.                (xptr) 0,       \
  44.                _JSR_OPCODE,    \
  45.                (void (*) __PROTO((void))) fn \
  46.             }
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50. #endif /* _XBRA_H */
  51.